<!-- 详情弹窗 -->
<template>
  <el-dialog
    title="详情"
    width="640px"
    :visible="visible"
    :lock-scroll="false"
    :destroy-on-close="true"
    @update:visible="updateVisible">
    <el-form
      size="mini"
      label-width="82px"
      class="ele-form-detail">
      <el-row :gutter="15">
        <el-col :sm="12">
          <el-form-item label="考核标准:">
            <div class="ele-text-secondary">
              {{ data.name }}
            </div>
          </el-form-item>
          <el-form-item label="备注:">
            <div class="ele-text-secondary">
              {{ data.note }}
            </div>
          </el-form-item>
        </el-col>
        <el-col :sm="12">
          <el-form-item label="所属学校:">
            <div class="ele-text-secondary">
              {{ data.organization_name }}
            </div>
          </el-form-item>
        </el-col>
      </el-row>
      <div style="margin: 12px 0;">
        <el-divider/>
      </div>
      <div style="margin: 6px 0 5px 0;">
        <el-header>考核标准</el-header>
      </div>
      <el-row justify="center" align="middle" style="height: 2vw;">
          <el-col style="text-align: center;" :sm="2">
          序号
          </el-col>
          <el-col style="text-align: center;" :sm="3">
            性别
          </el-col>
          <el-col style="text-align: center;" :sm="3">
            计算
          </el-col>
          <el-col style="text-align: center;" :sm="6">
            目标值
          </el-col>
          <el-col style="text-align: center;" :sm="3">
            单位
          </el-col>
          <el-col style="text-align: center;" :sm="3">
            考核等级
          </el-col>
          <el-col style="text-align: center;" :sm="3">
            考核分数
          </el-col>
      </el-row>
      <el-row :gutter="15"
       v-for="(item, index) in data.standard"
              :key="index"
              style="margin-left: 0.5vw"
              >
      <el-col :sm="2">
        <el-form-item label-width="0">
          {{index+1}}
        </el-form-item>
        </el-col>
      <el-col :sm="3">
          <el-form-item label-width="0">
            {{ item.sex==1?'男':'女' }}
          </el-form-item>
        </el-col>
        <el-col :sm="3">
          <el-form-item label-width="0">
             {{ item.conditions=='gt'?'大于':''}}
             {{ item.conditions=='egt'?'大于等于':''}}
             {{ item.conditions=='lt'?'小于':''}}
             {{ item.conditions=='elt'?'小于等于':''}}
             {{ item.conditions=='between'?'范围':''}}
          </el-form-item>
        </el-col>
        <el-col :sm="6">
            <el-form-item label-width="0">
              <el-col :sm="item.target[1]?10:24" style="text-align: center;">
                  {{ item.target[0]}}
                </el-col>
                <el-col :sm="4" v-if="item.target[1]" style="text-align: center;">
                  —
                </el-col>
                <el-col :sm="10" v-if="item.target[1]" style="text-align: center;">
                {{ item.target[1]}}
                  </el-col>
            </el-form-item>
        </el-col>
        <el-col :sm="3" label-width="0">
          <el-block v-for="item2 in staunit">
          {{ item2.value==item.unit?item2.label:''}}
          </el-block>
        </el-col>
        <el-col :sm="3">
          <el-form-item label-width="0">
            <el-block v-if="item.unit=='kg/m^2'">
             <el-block v-for="item2 in stalevel2">
              {{ item2.value==item.level?item2.label:''}}
              </el-block>
            </el-block>
            <el-block v-if="item.unit!='kg/m^2'">
             <el-block v-for="item2 in stalevel1">
              {{ item2.value==item.level?item2.label:''}}
              </el-block>
            </el-block>
          </el-form-item>
        </el-col>
        <el-col :sm="3">
          <el-form-item label-width="0">
            {{ item.score}}
          </el-form-item>
        </el-col>

      </el-row>
    </el-form>
    <div slot="footer">
      <el-button @click="updateVisible(false)">关闭
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'StandardDetail',
  props: {
    // 弹窗是否打开
    visible: Boolean,
    // 数据
    data: Object
  },
  data() {
    return {
      // 表单数据
      form: Object.assign({status:1}, this.data),
      staunit:[
        {label:'次/分钟',value:'time'},
        {label:'毫升',value:'ml'},
        {label:'厘米',value:'cm'},
        {label:'秒',value:'s'},
        {label:'千克/米^2',value:'kg/m^2'}
      ],
      stalevel: [],
      // 等级数据1
      stalevel1: [
        {label:'优秀',value:1},
        {label:'良好',value:2},
        {label:'及格',value:3},
        {label:'不及格',value:0}
      ],
      // 等级数据2
      stalevel2: [
        {label:'偏瘦',value:1},
        {label:'正常',value:2},
        {label:'超重',value:3},
        {label:'肥胖',value:0}
      ],
    };
  },
  methods: {
    /* 更新visible */
    updateVisible(value) {
      this.$emit('update:visible', value);
    }
  }
}
</script>

<style scoped>
</style>
